<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> 
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %>
<trans:initPage module="filter" />
<table width=95%>
<tr>
<!--MENU-->
<td valign=top>
<table width="85%" align="center" cellpadding="5" cellspacing="1" border="0" bgcolor="#3399CC">
 <tr>
    <td class=textalb>
     <logic:equal name="editProjectFilterForm" property="id" value="-1">
      <div align=center><trans:showPageMessage label="filter.addnewfilt" /></div>
     </logic:equal>
     <logic:notEqual name="editProjectFilterForm" property="id" value="-1">
      <div align=center><trans:showPageMessage label="filter.editfilt" /><bean:write name="editProjectFilterForm" property="id"/></div>
     </logic:notEqual>
    </td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td class="text_search" align=center>
<html:form action="/prjfilter">

<html:hidden property="id"/>
<html:hidden property="alerterId"/>
<html:hidden property="sector"/>
<html:hidden property="fundingOrg"/>
<html:hidden property="contractingOrg"/>
<html:hidden property="beneficiaryOrg"/>
<html:hidden property="donorOrg"/>
<html:hidden property="involvedPerson"/>
<html:hidden property="mode" value=""/>
<html:hidden property="extern_modifier" value=""/>
<html:hidden property="sector_id" value=""/>

<table bgcolor="#3399CC" class="text">
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.sector" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="filter.select" hide_link="true" />
                  " onclick="javascript:document.editProjectFilterForm.extern_modifier.value 
                  = 'sector';select_sector();"/> <logic:present name="Sector"> 
                  <bean:write name="Sector" property="title"/> </logic:present> 
                  <logic:notPresent name="Sector"> </logic:notPresent> </td>
	</tr>
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.fundingorg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="filter.select" hide_link="true" />" onclick="javascript:document.editProjectFilterForm.extern_modifier.value = 'funding';open_orgs();"/>
		<logic:present name="FundingOrg">
			<bean:write name="FundingOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="FundingOrg">
			<trans:showPageMessage label="filter.nofundingorgsel" />
		</logic:notPresent>



		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.contractingorg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="filter.select" hide_link="true" />" onclick="javascript:document.editProjectFilterForm.extern_modifier.value = 'contracting';open_orgs();"/>
		<logic:present name="ContractingOrg">
			<bean:write name="ContractingOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="ContractingOrg">
			<trans:showPageMessage label="filter.nocontractingorgsel" /></logic:notPresent>
		</td>
	</tr>
	
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.benorg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="filter.select" hide_link="true" />" onclick="javascript:document.editProjectFilterForm.extern_modifier.value = 'beneficiary';open_orgs();"/>
		<logic:present name="BeneficiaryOrg">
			<bean:write name="BeneficiaryOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="BeneficiaryOrg">
			<trans:showPageMessage label="filter.nobenorgsel" />
		</logic:notPresent>
		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.donororg" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="filter.select" hide_link="true" />" onclick="javascript:document.editProjectFilterForm.extern_modifier.value = 'donor';open_orgs();"/>
		<logic:present name="DonorOrg">
			<bean:write name="DonorOrg" property="name"/>
		</logic:present>
		<logic:notPresent name="DonorOrg">
			<trans:showPageMessage label="filter.nodonorsel" />
		</logic:notPresent>
		</td>
	</tr>
		
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.invpers" />:</b>
		</td>
		<td>
<input class="buton" type=button value="<trans:showPageMessage label="filter.select" hide_link="true" />" onclick="javascript:document.editProjectFilterForm.extern_modifier.value = 'person';open_pers();"/>
		<logic:present name="Person">
			<bean:write name="Person" property="name"/>
		</logic:present>
		<logic:notPresent name="Person">
			<trans:showPageMessage label="filter.noinvpersel" />
		</logic:notPresent>
		</td>
	</tr>
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.projstatus" />:</b>
		</td>
		<td>
		<html:select property="stat">
		<html:option value="-1"><trans:showPageMessage label="filter.selstatus" hide_link="true" /></html:option>
		<html:options collection="Status_LIST" property="id" labelProperty="status"/>
		</html:select>
		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.title" />:</b>
		</td>
		<td>
		<html:text size="60" property="title" styleClass="text"/>
		</td>
	</tr>
		
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.desc" />:</b>
		</td>
		<td>
		<html:text size="60" property="description" styleClass="text"/>
		</td>
	</tr>
	
		<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.key" />:</b>
		</td>
		<td>
		<html:text size="60" property="keywords" styleClass="text"/>
		</td>
	</tr>
	
	<tr bgcolor="#FFFFFF">
		<td align=right>
		<b><trans:showPageMessage label="filter.loccountry" />:</b>
		</td>
		<td>
		<html:select property="country_iso3">
		<html:option value="-1"><trans:showPageMessage label="filter.selcountry" hide_link="true" /></html:option>
		<html:options collection="Country_LIST" property="iso3" labelProperty="name"/>
		</html:select>
		</td>
	</tr>
	
	<tr bgcolor="f2f2f2">
		<td height="40" colspan=2 align=center>
			<html:submit styleClass="butonsave" property="save" onclick="document.editProjectFilterForm.mode.value='save';">
			  <logic:notEqual name="editProjectFilterForm" property="id" value="-1">
			  <trans:showPageMessage label="filter.save" hide_link="true" />
			  </logic:notEqual>
			  <logic:equal name="editProjectFilterForm" property="id" value="-1">
			  <trans:showPageMessage label="filter.addthisfilter" hide_link="true" />
			  </logic:equal>
			</html:submit>
			<p>	
		</td>
	</tr>

</table>

<script language="javascript">
    function open_orgs() {
        ed_donor_orgs_win = window.open(
        '<html:rewrite page="/org/selector.do"/>',
        'ed_donor_win', 'HEIGHT=400,WIDTH=500,scrollbars=yes');
    };
    
    function after_org_sel() {
       document.editProjectFilterForm.submit();
    };
    
    
    function after_pers_sel() {
       document.editProjectFilterForm.submit();
     };
    
    
    function add_sector(dac5, crs) {
	       if (dac5!=-1) {
        document.editProjectFilterForm.sector_id.value=dac5;
		
      } else
      if (crs!=-1) {
        document.editProjectFilterForm.sector_id.value=crs;
      } else
      document.editProjectFilterForm.sector_id.value=-1;
	    document.editProjectFilterForm.submit();
	};
 
	function select_sector() {
      window.open("<html:rewrite page="/sectors/browser.do" />", "sector_selector",
            "status=yes,WIDTH=700,HEIGHT=400,scrollbars=yes");
	};
	
	function open_pers() {
          ed_pers_win = window.open("<html:rewrite page="/pers/selector.do?"/>?perskey=Prjfilter_Person", "ed_win", "HEIGHT=400,WIDTH=500,scrollbars=yes");

     };
	
</script>	
	
</html:form>

</td></tr>

</table>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="text_search" align=center>
<html:link page="/desktop.do"><trans:showPageMessage label="filter.backtomydesktop" hide_link="true" />
</html:link>
</td></tr>
</table><trans:showPageMessage label="translator.showhiddentags"/>